<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Input;
use DB;
use Redirect;

class AccountController extends Controller{

	/**
	  * @author : Where
	  * @email : liuzhaowei55@gmail.com
	  * @time : 2015-08-09 15:52:00
	  *
	  * @describe:添加账户
	  *
	  *
	  **/	
	public function addAccount(){
		return view('account/addAcount');
	}

	/**
	  * @author : Where
	  * @email : liuzhaowei55@gmail.com
	  * @time : 2015-08-09 16:21:00
	  *
	  * @describe:保存新添账户信息
	  *
	  *
	  **/	
	public function saveAccount(){
		$title = Input::get('title');
		$amount = Input::get('amount');
		$time = time();
		$Account = array();
		$Account['title'] = $title;
		$Account['amount'] = $amount;
		$Account['time'] = $time;
		DB::table('account')->insert($Account);
		return Redirect::to('/');
	}

	/**
	  * @author : Where
	  * @email : liuzhaowei55@gmail.com
	  * @time : 2015-08-09 16:31:00
	  *
	  * @describe:删除账户
	  *
	  *
	  **/	
	public function delAccount($id){
		$where = array();
		$where['id'] = $id;
		$data = array();
		$data['display'] = 0;
		DB::table('account')->where($where)->update($data);
		return Redirect::to('/');
	}
}